From: kaf24@firebug.cl.cam.ac.uk Date: Thu, 1 Jun 2006 20:49:25 +0000 (+0100) Subject: Use DEFINE_SPINLOCK consistently throughout Xen. X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~15972^2~49^2~28 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/success//%22http:/www.example.com/cgi/success/?a=commitdiff_plain;h=8cd06eb3230a77ab567a4ebf4ba5876980c8f9e4;p=xen.git Use DEFINE_SPINLOCK consistently throughout Xen. Signed-off-by: Keir Fraser --- diff --git a/xen/arch/x86/cpu/mtrr/main.c b/xen/arch/x86/cpu/mtrr/main.c index 4737caf8aa..5684d40c89 100644 --- a/xen/arch/x86/cpu/mtrr/main.c +++ b/xen/arch/x86/cpu/mtrr/main.c @@ -43,7 +43,7 @@ #include "mtrr.h" /* No blocking mutexes in Xen. Spin instead. */ -#define DECLARE_MUTEX(_m) spinlock_t _m = SPIN_LOCK_UNLOCKED +#define DECLARE_MUTEX(_m) DEFINE_SPINLOCK(_m) #define down(_m) spin_lock(_m) #define up(_m) spin_unlock(_m) #define lock_cpu_hotplug() ((void)0) diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c index 561ca00a79..4e4c4f568e 100644 --- a/xen/arch/x86/hvm/svm/svm.c +++ b/xen/arch/x86/hvm/svm/svm.c @@ -84,28 +84,26 @@ struct svm_percore_globals svm_globals[NR_CPUS]; /* * Initializes the POOL of ASID used by the guests per core. */ -void asidpool_init( int core ) +void asidpool_init(int core) { int i; - svm_globals[core].ASIDpool.asid_lock = SPIN_LOCK_UNLOCKED; - spin_lock(&svm_globals[core].ASIDpool.asid_lock); + + spin_lock_init(&svm_globals[core].ASIDpool.asid_lock); + /* Host ASID is always in use */ svm_globals[core].ASIDpool.asid[INITIAL_ASID] = ASID_INUSE; - for( i=1; iguest_asid = i; svm_globals[core].ASIDpool.asid[i] = ASID_INUSE; diff --git a/xen/arch/x86/i8259.c b/xen/arch/x86/i8259.c index 17bab16f9c..76c47b5592 100644 --- a/xen/arch/x86/i8259.c +++ b/xen/arch/x86/i8259.c @@ -102,7 +102,7 @@ BUILD_SMP_INTERRUPT(thermal_interrupt,THERMAL_APIC_VECTOR) * moves to arch independent land */ -spinlock_t i8259A_lock = SPIN_LOCK_UNLOCKED; +static DEFINE_SPINLOCK(i8259A_lock); static void disable_8259A_vector(unsigned int vector) { diff --git a/xen/arch/x86/microcode.c b/xen/arch/x86/microcode.c index 2e31eea480..d1b185e168 100644 --- a/xen/arch/x86/microcode.c +++ b/xen/arch/x86/microcode.c @@ -83,7 +83,7 @@ #include #define pr_debug(x...) ((void)0) -#define DECLARE_MUTEX(_m) spinlock_t _m = SPIN_LOCK_UNLOCKED +#define DECLARE_MUTEX(_m) DEFINE_SPINLOCK(_m) #define down(_m) spin_lock(_m) #define up(_m) spin_unlock(_m) #define vmalloc(_s) xmalloc_bytes(_s) diff --git a/xen/arch/x86/smp.c b/xen/arch/x86/smp.c index 590e35921e..d56440d8e6 100644 --- a/xen/arch/x86/smp.c +++ b/xen/arch/x86/smp.c @@ -161,7 +161,7 @@ void send_IPI_mask_phys(cpumask_t mask, int vector) local_irq_restore(flags); } -static spinlock_t flush_lock = SPIN_LOCK_UNLOCKED; +static DEFINE_SPINLOCK(flush_lock); static cpumask_t flush_cpumask; static unsigned long flush_va; diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c index 85f52f4d75..54a3ce41d4 100644 --- a/xen/arch/x86/time.c +++ b/xen/arch/x86/time.c @@ -40,10 +40,10 @@ boolean_param("hpet_force", opt_hpet_force); unsigned long cpu_khz; /* CPU clock frequency in kHz. */ unsigned long hpet_address; -spinlock_t rtc_lock = SPIN_LOCK_UNLOCKED; +DEFINE_SPINLOCK(rtc_lock); unsigned long volatile jiffies; static u32 wc_sec, wc_nsec; /* UTC time at last 'time update'. */ -static spinlock_t wc_lock = SPIN_LOCK_UNLOCKED; +static DEFINE_SPINLOCK(wc_lock); struct time_scale { int shift; @@ -67,7 +67,7 @@ static struct cpu_time cpu_time[NR_CPUS]; static s_time_t stime_platform_stamp; static u64 platform_timer_stamp; static struct time_scale platform_timer_scale; -static spinlock_t platform_timer_lock = SPIN_LOCK_UNLOCKED; +static DEFINE_SPINLOCK(platform_timer_lock); static u64 (*read_platform_count)(void); /* diff --git a/xen/arch/x86/x86_32/domain_page.c b/xen/arch/x86/x86_32/domain_page.c index 243a81fac5..4a7362d7e2 100644 --- a/xen/arch/x86/x86_32/domain_page.c +++ b/xen/arch/x86/x86_32/domain_page.c @@ -183,7 +183,7 @@ void mapcache_init(struct domain *d) static unsigned long inuse[BITS_TO_LONGS(GLOBALMAP_BITS)]; static unsigned long garbage[BITS_TO_LONGS(GLOBALMAP_BITS)]; static unsigned int inuse_cursor; -static spinlock_t globalmap_lock = SPIN_LOCK_UNLOCKED; +static DEFINE_SPINLOCK(globalmap_lock); void *map_domain_page_global(unsigned long pfn) { diff --git a/xen/common/dom0_ops.c b/xen/common/dom0_ops.c index 49bb47840b..56c1847101 100644 --- a/xen/common/dom0_ops.c +++ b/xen/common/dom0_ops.c @@ -95,7 +95,7 @@ long do_dom0_op(XEN_GUEST_HANDLE(dom0_op_t) u_dom0_op) long ret = 0; struct dom0_op curop, *op = &curop; void *ssid = NULL; /* save security ptr between pre and post/fail hooks */ - static spinlock_t dom0_lock = SPIN_LOCK_UNLOCKED; + static DEFINE_SPINLOCK(dom0_lock); if ( !IS_PRIV(current->domain) ) return -EPERM; diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c index ab5cd1298a..55fc27a5a3 100644 --- a/xen/common/page_alloc.c +++ b/xen/common/page_alloc.c @@ -59,7 +59,7 @@ custom_param("lowmem_emergency_pool", parse_lowmem_emergency_pool); #define round_pgdown(_p) ((_p)&PAGE_MASK) #define round_pgup(_p) (((_p)+(PAGE_SIZE-1))&PAGE_MASK) -static spinlock_t page_scrub_lock = SPIN_LOCK_UNLOCKED; +static DEFINE_SPINLOCK(page_scrub_lock); LIST_HEAD(page_scrub_list); /********************* @@ -250,7 +250,7 @@ static struct list_head heap[NR_ZONES][MAX_ORDER+1]; static unsigned long avail[NR_ZONES]; -static spinlock_t heap_lock = SPIN_LOCK_UNLOCKED; +static DEFINE_SPINLOCK(heap_lock); void end_boot_allocator(void) { diff --git a/xen/common/perfc.c b/xen/common/perfc.c index df63c1042b..830e1876b5 100644 --- a/xen/common/perfc.c +++ b/xen/common/perfc.c @@ -209,7 +209,7 @@ static int perfc_copy_info(XEN_GUEST_HANDLE(dom0_perfc_desc_t) desc) /* Dom0 control of perf counters */ int perfc_control(dom0_perfccontrol_t *pc) { - static spinlock_t lock = SPIN_LOCK_UNLOCKED; + static DEFINE_SPINLOCK(lock); u32 op = pc->op; int rc; diff --git a/xen/common/trace.c b/xen/common/trace.c index 6a7827299a..7e480d0bb4 100644 --- a/xen/common/trace.c +++ b/xen/common/trace.c @@ -173,7 +173,7 @@ void init_trace_bufs(void) */ int tb_control(dom0_tbufcontrol_t *tbc) { - static spinlock_t lock = SPIN_LOCK_UNLOCKED; + static DEFINE_SPINLOCK(lock); int rc = 0; spin_lock(&lock); diff --git a/xen/common/xmalloc.c b/xen/common/xmalloc.c index 038303960f..019bf9987a 100644 --- a/xen/common/xmalloc.c +++ b/xen/common/xmalloc.c @@ -35,7 +35,7 @@ #include static LIST_HEAD(freelist); -static spinlock_t freelist_lock = SPIN_LOCK_UNLOCKED; +static DEFINE_SPINLOCK(freelist_lock); struct xmalloc_hdr { diff --git a/xen/drivers/char/console.c b/xen/drivers/char/console.c index 12104c1e3c..f3a547038e 100644 --- a/xen/drivers/char/console.c +++ b/xen/drivers/char/console.c @@ -53,7 +53,7 @@ static char printk_prefix[16] = ""; static int sercon_handle = -1; static int vgacon_enabled = 0; -spinlock_t console_lock = SPIN_LOCK_UNLOCKED; +static DEFINE_SPINLOCK(console_lock); /* * ******************************************************* @@ -563,7 +563,7 @@ static char *debugtrace_buf; /* Debug-trace buffer */ static unsigned int debugtrace_prd; /* Producer index */ static unsigned int debugtrace_kilobytes = 128, debugtrace_bytes; static unsigned int debugtrace_used; -static spinlock_t debugtrace_lock = SPIN_LOCK_UNLOCKED; +static DEFINE_SPINLOCK(debugtrace_lock); integer_param("debugtrace", debugtrace_kilobytes); void debugtrace_dump(void) @@ -675,7 +675,7 @@ void panic(const char *fmt, ...) va_list args; char buf[128]; unsigned long flags; - static spinlock_t lock = SPIN_LOCK_UNLOCKED; + static DEFINE_SPINLOCK(lock); extern void machine_restart(char *); debugtrace_dump(); diff --git a/xen/include/xen/console.h b/xen/include/xen/console.h index aa93eb32ad..b7232f305f 100644 --- a/xen/include/xen/console.h +++ b/xen/include/xen/console.h @@ -10,8 +10,6 @@ #include #include -extern spinlock_t console_lock; - void set_printk_prefix(const char *prefix); long read_console_ring(XEN_GUEST_HANDLE(char), u32 *, int);